function controlAction() {
    if (isEmpty($("#searchText").val())){
        alert("输入为空")
        return false
    }
    return true
}
function reloadPage() {
    location.reload()
}

$("button").click(function (e) {
    var type = e.target.textContent
    if (type === "删除") {
        $.ajax({
            type: "post",
            url: "/deleteUser",
            dataType: "json",
            data: {
                "username": e.target.name
            },
            success: function (result) {
                // alert("用户"+e.target.name+"删除成功！")
                commonUtil.message("用户" + e.target.name + "删除成功！", "danger", 1000)
                setTimeout(reloadPage, 2000);
            },
        });
    } else if (type === "重置密码") {
        $.ajax({
            type: "post",
            url: "/updateUser",
            dataType: "json",
            data: {
                "username": e.target.name
            },
            success: function (result) {
                // alert("用户"+e.target.name+"密码重置成功！重置后密码为000")
                commonUtil.message("用户" + e.target.name + "密码重置成功！重置后密码为000", "info", 1000)
                setTimeout(reloadPage, 2000);
            },
        });
    }
});
